# -*- coding: utf-8 -*-
"""
全局样式表
提供统一的应用程序样式
"""

# 全局样式表
GLOBAL_STYLESHEET = """
/* 全局样式 */
QWidget {
    font-family: "Microsoft YaHei", "SimHei", Arial, sans-serif;
    font-size: 14px;
    color: #333;
}

/* 主窗口样式 */
QMainWindow {
    background-color: #f8f9fa;
    color: #333;
}

/* 导航树样式 */
QTreeWidget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 5px;
    font-size: 13px;
}

QTreeWidget::item {
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 3px;
}

QTreeWidget::item:selected {
    background-color: #4a90e2;
    color: white;
    font-weight: 500;
}

QTreeWidget::item:hover {
    background-color: #f1f3f4;
}

/* 标签页样式 */
QTabWidget::pane {
    border: 1px solid #e9ecef;
    background-color: #ffffff;
}

QTabBar::tab {
    background-color: #f8f9fa;
    padding: 8px 16px;
    margin-right: 2px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    color: #666;
}

QTabBar::tab:selected {
    background-color: #ffffff;
    color: #4a90e2;
    border-bottom: 2px solid #4a90e2;
}

QTabBar::tab:hover {
    background-color: #e9ecef;
}

/* 菜单栏样式 */
QMenuBar {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

QMenuBar::item {
    padding: 8px 12px;
    font-size: 13px;
}

QMenuBar::item:selected {
    background-color: #f1f3f4;
    color: #4a90e2;
}

QMenu {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
}

QMenu::item {
    padding: 6px 12px;
}

QMenu::item:selected {
    background-color: #f1f3f4;
    color: #4a90e2;
}

/* 状态栏样式 */
QStatusBar {
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    color: #666;
    font-size: 12px;
}

/* 按钮样式 */
QPushButton {
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
}

QPushButton:hover {
    background-color: #357abd;
}

QPushButton:pressed {
    background-color: #2968aa;
}

QPushButton:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
}

/* 输入框样式 */
QLineEdit, QComboBox, QTextEdit {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    background-color: #ffffff;
}

QLineEdit:focus, QComboBox:focus, QTextEdit:focus {
    border: 1px solid #4a90e2;
}

/* 表格样式 */
QTableWidget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    gridline-color: #f1f3f4;
    font-size: 12px;
    selection-background-color: #e3f2fd;
}

QTableWidget::item {
    padding: 6px;
    border-bottom: 1px solid #f1f3f4;
}

QTableWidget::item:selected {
    background-color: #e3f2fd;
    color: #1976d2;
}

QHeaderView::section {
    background-color: #f8f9fa;
    padding: 8px 6px;
    border: none;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #4a90e2;
    font-weight: 600;
    font-size: 12px;
    color: #495057;
}

/* 分组框样式 */
QGroupBox {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-top: 8px;
    padding-top: 8px;
    background-color: #ffffff;
}

QGroupBox::title {
    subcontrol-origin: margin;
    left: 8px;
    padding: 0 4px 0 4px;
    color: #4a90e2;
}

/* 列表样式 */
QListWidget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 3px;
    font-size: 12px;
}

QListWidget::item {
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 3px;
}

QListWidget::item:selected {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

QListWidget::item:hover {
    background-color: #f1f3f4;
}

/* 标签样式 */
QLabel {
    color: #495057;
    font-size: 13px;
}

/* 分割器样式 */
QSplitter::handle {
    background-color: #e9ecef;
    width: 2px;
}

QSplitter::handle:hover {
    background-color: #adb5bd;
}

/* 对话框样式 */
QDialog {
    background-color: #f8f9fa;
    font-family: "Microsoft YaHei";
}
"""

# 颜色主题常量
class Colors:
    # 主色调
    PRIMARY = "#4a90e2"
    PRIMARY_DARK = "#357abd"
    PRIMARY_DARKER = "#2968aa"
    PRIMARY_LIGHT = "#5ba0f2"
    
    # 成功色
    SUCCESS = "#28a745"
    SUCCESS_DARK = "#218838"
    SUCCESS_DARKER = "#1e7e34"
    
    # 警告色
    WARNING = "#ffc107"
    WARNING_DARK = "#e0a800"
    WARNING_DARKER = "#d39e00"
    
    # 危险色
    DANGER = "#dc3545"
    DANGER_DARK = "#c82333"
    DANGER_DARKER = "#bd2130"
    
    # 信息色
    INFO = "#17a2b8"
    INFO_DARK = "#138496"
    INFO_DARKER = "#117a8b"
    
    # 次要色
    SECONDARY = "#6c757d"
    SECONDARY_DARK = "#5a6268"
    SECONDARY_DARKER = "#545b62"
    
    # 中性色
    LIGHT = "#f8f9fa"
    BORDER = "#e9ecef"
    MUTED = "#6c757d"
    
    # 文本色
    TEXT_PRIMARY = "#333333"
    TEXT_SECONDARY = "#495057"
    TEXT_MUTED = "#666666"
    
    # 背景色
    BACKGROUND = "#f8f9fa"
    SURFACE = "#ffffff"
    
    # 状态色
    SUCCESS_LIGHT = "#e3f2fd"
    WARNING_LIGHT = "#fff3cd"
    DANGER_LIGHT = "#f8d7da"

# 按钮样式类
class ButtonStyles:
    PRIMARY = "primary"
    WARNING = "warning"
    DANGER = "danger"
    INFO = "info"
    SECONDARY = "secondary"